package com.eduadmin.service;

import com.eduadmin.entity.Category;
import com.eduadmin.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements ICategoryService {
    private final CategoryMapper categoryMapper;

    @Autowired
    public CategoryServiceImpl(CategoryMapper categoryMapper) {
        this.categoryMapper = categoryMapper;
    }

    @Override
    public List<Category> getAllCategory() {
        return categoryMapper.getAllCategory();
    }

    @Override
    public int addCategorys(List<Category> categorys) {
        return categoryMapper.insertCategorys(categorys);
    }

    @Override
    public Category getCategoryByName(String categoryName) {
        return categoryMapper.selectCategoryByName(categoryName);
    }

}
